﻿@model Presentation.Web.ViewModels.FlairViewModel
@{

var line1 = "document.write('<script>var link = document.createElement(\"link\");link.href=\"~/content/Flair.css\";link.rel = \"stylesheet\";link.type = \"text/css\";var head = document.getElementsByTagName(\"head\")[0];head.appendChild(link);</script>');";
var line2 = "document.write('<div id=\"nd-wrapper\"><h2 id=\"nd-header\">NerdDinner.com</h2><div id=\"nd-outer\">');";

string middleLines = "";

if (Model.Dinners.Count == 0) {
	middleLines += "document.write('<div id=\"nd-bummer\">Looks like there&#39;s no Nerd Dinners near ";
	middleLines += Model.LocationName +  "in the near future. Why not <a target=\"_blank\" href=\"~/Dinners/Create\">host one</a>?</div>');";
} else {

	middleLines += "document.write('<h3>  Dinners Near You</h3><ul>');";
		foreach (var item in Model.Dinners) {
			middleLines += "document.write('<li><a target=\"_blank\" href=\"http://nrddnr.com/@item.DinnerID\">@item.Title.Truncate(20) %> with @item.HostedBy on @item.EventDate.ToShortDateString()</a></li>');";
		}
	middleLines += "document.write('</ul>');";
}
string lastLine = "document.write('<div id=\"nd-footer\">  More dinners and fun at <a target=\"_blank\" href=\"http://nrddnr.com\">http://nrddnr.com</a></div></div></div>');";
}
@MvcHtmlString.Create(line1)
@MvcHtmlString.Create(line2)
@MvcHtmlString.Create(middleLines)
@MvcHtmlString.Create(lastLine)